package com.pro.service.imple;

import com.pro.mapper.JsBeforeUserMapper;
import com.pro.pojo.JsBeforeUser;
import com.pro.pojo.JsMonthCount;
import com.pro.pojo.JsonData;
import com.pro.service.JsBeforeUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;


/**
 * ClassName:JsBeforeUserServiceImple
 * Package:com.pro.service.imple
 * Description:
 *
 * @Date:2021/11/13 14:56
 * @Author: ZPT
 */
@Service
public class JsBeforeUserServiceImple implements JsBeforeUserService {
    @Autowired(required = false)
    private JsBeforeUserMapper mapper;

    @Override
    public JsonData getBeforeUserTable() {
        List<JsBeforeUser> list = mapper.getBeforeUserTable();
        int count = count();
        return list!=null?JsonData.buildSuccess(list,count):JsonData.buildError("服务端错误");
    }

    @Override
    public int count() {
        return mapper.count();
    }

    @Override
    public Integer updateStatus(Integer userId, Integer status) {
        return mapper.updateStatus(userId,status);
    }

    @Override
    public JsonData getSearchBeforeUser(String account, String createDate, String nickname) {
        List<JsBeforeUser> list = mapper.getSearchBeforeUser(account, createDate, nickname);
        return list!=null?JsonData.buildSuccess(list):JsonData.buildError("服务端错误");
    }

    @Override
    public Integer delBeforeUser(Integer userId) {
        return mapper.delBeforeUser(userId);
    }

    @Override
    public JsonData getRetrievalTable(String userCode, String consumption, Integer studyDate) {
        List<JsBeforeUser> list = mapper.getRetrievalTable(userCode, consumption, studyDate);
        return list!=null?JsonData.buildSuccess(list):JsonData.buildError("服务端错误");
    }

    @Override
    public JsBeforeUser getinformation(Integer userId) {
        return mapper.getinformation(userId);
    }

    @Override
    public Integer updateBeforeUser(JsBeforeUser jsBeforeUser) {
        return mapper.updateBeforeUser(jsBeforeUser);
    }

    @Override
    public List<JsBeforeUser> getNonUserDevelopment(String account, String createDate, String nickname,
                                                    String userCode, String consumption, Integer studyDate) {
        return mapper.getNonUserDevelopment(account, createDate, nickname,userCode, consumption, studyDate);
    }

    @Override
    public JsBeforeUser getNonUserDevelopmentById(Integer userId,String consumption) {
        return mapper.getNonUserDevelopmentById(userId,consumption);
    }

    @Override
    public List<JsBeforeUser> getZeroConsumeUser() {
        return mapper.getZeroConsumeUser();
    }

    @Override
    public List<JsMonthCount> countMonth() {
        return mapper.countMonth();
    }

    @Override
    public int yesterdayAddCount() {
        return mapper.yesterdayAddCount();
    }

    @Override
    public int todayAddCount() {
        return mapper.todayAddCount();
    }

    @Override
    public int monthAddCount() {
        return mapper.monthAddCount();
    }
}
